<?php /* Smarty version Smarty-3.1.18, created on 2017-05-31 12:15:13
         compiled from "/data/www/mystery/protected/modules/webadmin/views/netquestion/attach.tpl" */ ?>
<?php /*%%SmartyHeaderCode:1875326010552e6df2d077b3-68390951%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '97a6816962f7f5e7dace9e155444b51f98a3e18c' => 
    array (
      0 => '/data/www/mystery/protected/modules/webadmin/views/netquestion/attach.tpl',
      1 => 1494904920,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1875326010552e6df2d077b3-68390951',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.18',
  'unifunc' => 'content_552e6df2d9ff16_74456632',
  'variables' => 
  array (
    'question_info' => 0,
    'net_info' => 0,
    'subject_info' => 0,
    'answer' => 0,
    'list' => 0,
    'val' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_552e6df2d9ff16_74456632')) {function content_552e6df2d9ff16_74456632($_smarty_tpl) {?><html>
    <head>
    <script src="/js/jquery-1.11.1.min.js"></script>	
        <script type="text/javascript" src='/js/layer/layer.min.js'></script>
<script type="text/javascript" src='/js/layer/extend/layer.ext.js'></script>
    <link type="text/css" href="/css/iframe.css" rel="stylesheet">
    <title><?php if ($_smarty_tpl->tpl_vars['question_info']->value['question_name']) {?><?php echo $_smarty_tpl->tpl_vars['question_info']->value['question_name'];?>
<?php }?>附件</title>
<script type="text/javascript">
function AutoResizeImage(maxWidth,maxHeight,objImg){
    var img = new Image();
    img.src = objImg.src;
    var hRatio;
    var wRatio;
    var Ratio = 1;
    var w = img.width;
    var h = img.height;
    wRatio = maxWidth / w;
    hRatio = maxHeight / h;
    if (maxWidth ==0 && maxHeight==0){
        Ratio = 1;
    }else if (maxWidth==0){
        if (hRatio<1) Ratio = hRatio;
    }else if (maxHeight==0){
    if (wRatio<1) Ratio = wRatio;
    }else if (wRatio<1 || hRatio<1){
        Ratio = (wRatio<=hRatio?wRatio:hRatio);
    }
    if (Ratio<1){
        w = w * Ratio;
        h = h * Ratio;
    }
        objImg.height = h;
        objImg.width = w;
}
</script>
    </head>
    <body>
        <div style="padding:10px; border:1px solid #ccc; background-color:#eee;position: fixed;top: 0;"><p>播放MP4需下载安装QUICKTIME插件,<a href="/assets/QuickTimeInstaller_5200000014856956654.exe" target="_blank">下载</a>
WMV,AVI需要windown系统中安装WINDOW MEDIA PLAYER播放器，火狐浏览器需同时安装相应插件，<a href="/assets/wmpfirefoxplugin.exe" target="_blank">下载</a>,安装成功后火狐地址栏输入about:config查找选项plugins.load_appdir_plugins双击改为true</p></div>
        <h2><?php if ($_smarty_tpl->tpl_vars['net_info']->value) {?><?php echo $_smarty_tpl->tpl_vars['net_info']->value['network_name'];?>
<?php }?><?php if ($_smarty_tpl->tpl_vars['question_info']->value) {?>--<?php echo $_smarty_tpl->tpl_vars['question_info']->value['question_name'];?>
<?php }?><?php if ($_smarty_tpl->tpl_vars['subject_info']->value) {?>--<?php echo $_smarty_tpl->tpl_vars['subject_info']->value['title'];?>
<?php }?></h2>
        <p style="line-height: 30px;font-size: 14px;"><?php echo $_smarty_tpl->tpl_vars['subject_info']->value['content'];?>
</p>
        <br/>
        <a href="javascript:;" onclick="delall(<?php echo $_smarty_tpl->tpl_vars['net_info']->value['nq_id'];?>
, <?php echo $_smarty_tpl->tpl_vars['subject_info']->value['subject_id'];?>
)" >删除此问题所有附件</a>
        <div id='allattach'>
        <?php if ($_smarty_tpl->tpl_vars['answer']->value['answer_desc']) {?><p style="line-height: 30px;font-size: 14px;color:red;"><?php echo $_smarty_tpl->tpl_vars['answer']->value['answer_desc'];?>
</p><?php }?>

        <?php if ($_smarty_tpl->tpl_vars['list']->value) {?>
        <?php  $_smarty_tpl->tpl_vars['val'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['val']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['list']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['val']->key => $_smarty_tpl->tpl_vars['val']->value) {
$_smarty_tpl->tpl_vars['val']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['val']->key;
?>
        <div id='nqa_<?php echo $_smarty_tpl->tpl_vars['val']->value['nqa_id'];?>
'>
            <?php if ($_smarty_tpl->tpl_vars['val']->value['extension']=='img') {?>
                <img src='<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
' onload="AutoResizeImage(250,0,this)" onclick="show_big(this);"  alt="点击看大图" style="cursor:pointer" />
                <a href="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
" target="_blank" >下载</a>
                <a href="javascript:;" onclick="del(<?php echo $_smarty_tpl->tpl_vars['val']->value['nqa_id'];?>
)" >删除</a>
            <?php }?>
        <?php if ($_smarty_tpl->tpl_vars['val']->value['ext']=='mp3') {?>
        <embed height="30" width="200" autostart="false" loop="false" src="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
" />
        <a href="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
" target="_blank" >下载</a>
        <a href="javascript:;" onclick="del(<?php echo $_smarty_tpl->tpl_vars['val']->value['nqa_id'];?>
)" >删除</a>
        <?php }?>
            <?php if ($_smarty_tpl->tpl_vars['val']->value['ext']=='mp4') {?>
        <OBJECT ID=video1 CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT=200 WIDTH=200> 
	<param name="_ExtentX" value="9313"> 
	<param name="_ExtentY" value="7620"> 
        <param name="allowFullScreen" value="true">
	<param name="AUTOSTART" value="0"> 
	<param name="SHUFFLE" value="0"> 
	<param name="PREFETCH" value="0"> 
	<param name="NOLABELS" value="0"> 
        <param name="SRC" value="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
"> 
	<param name="CONTROLS" value="ImageWindow"> 
	<param name="CONSOLE" value="Clip1"> 
	<param name="LOOP" value="0"> 
	<param name="NUMLOOP" value="0"> 
	<param name="CENTER" value="0">
	<param name="scale" value="tofit" />
	<param name="controller" value="true" /> 
	<param name="autoplay" value="false" />
	<param name="ShowAudioControls" value="-1">
	<param name="MAINTAINASPECT" value="0"> 
	<param name="BACKGROUNDCOLOR" value="#000000">
	<EMBED SRC="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
" type="video/quicktime" PLUGINSPAGE="http://www.apple.com/quicktime/download" WIDTH="200" HEIGHT="200" scale="tofit" controller="true" autoplay="false"></EMBED> 
        </OBJECT> 
        <a href="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
" target="_blank" >下载</a>
        <a href="javascript:;" onclick="del(<?php echo $_smarty_tpl->tpl_vars['val']->value['nqa_id'];?>
)" >删除</a>
        <?php }?>

        <?php if ($_smarty_tpl->tpl_vars['val']->value['ext']=='wmv') {?>
        <object width="200" height="200" type="video/x-ms-asf" url="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
" data="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
"
        classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
        <param name="url" value="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
">
        <param name="filename" value="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
">
        <param name="autostart" value="false">
        <param name="uiMode" value="full" />
        <param name="autosize" value="1">
        <param name="playcount" value="1">
        <embed type="application/x-mplayer2" src="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
" width="200"
         height="200" autostart="false" showcontrols="true" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"></embed>
        </object>
         <a href="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
" target="_blank" >下载</a>
         <a href="javascript:;" onclick="del(<?php echo $_smarty_tpl->tpl_vars['val']->value['nqa_id'];?>
)" >删除</a>
        <?php }?>
        
        <?php if ($_smarty_tpl->tpl_vars['val']->value['ext']=='avi') {?>
        <object width="200" height="200" type="video/x-ms-asf" url="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
" data="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
    <param name="url" value="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
">
    <param name="filename" value="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
">
    <param name="autostart" value="false">
    <param name="uiMode" value="full" />
    <param name="autosize" value="1">
    <param name="playcount" value="1">
    <embed type="application/x-mplayer2" src="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
" width="200"
     height="200" autostart="false" showcontrols="true" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"></embed>
    </object>
        <a href="<?php echo $_smarty_tpl->tpl_vars['val']->value['url'];?>
" target="_blank" >下载</a>
        <a href="javascript:;" onclick="del(<?php echo $_smarty_tpl->tpl_vars['val']->value['nqa_id'];?>
)" >删除</a>
        <?php }?>
        </div>
        <?php } ?>

        <?php }?>
        </div>
<script>
//删除
function del(nqa_id){
    if (confirm('确定删除')) {
        $.getJSON('/webadmin/netQuestion/Delattach',{nqa_id:nqa_id},function(res){
            if (res.status==1) {
                $('#nqa_'+nqa_id).remove();
            }
            alert(res.note);
        });    
    }
}
function delall(nq_id, subject_id){
    if (confirm('确定删除')) {
        $.getJSON('/webadmin/netQuestion/Delallattach',{nq_id:nq_id,subject_id:subject_id},function(res){
            if (res.status==1) {
                $('#allattach').remove();
            }
            alert(res.note);
        });    
    }
}
//显示大图
function show_big(obj){
    var img = new Image();
    img.src = obj.src;
    var width = img.width + 10;
    var height = img.height + 10;
    var pageii = $.layer({
        type: 1,
        title: false,
        area: [width+'px', height+'px'],
        border: [0], //去掉默认边框
        shade: [0], //去掉遮罩
        offset: ['150px',''],
        closeBtn: [0, true], //去掉默认关闭按钮
        page: {
            html: '<div style="width:'+width+'px;height:'+height+'px;"><img src="'+obj.src+'"</div>'
        }
    });  
}

</script>
    </body>
</html><?php }} ?>
